#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk

DEB_COMPRESS_EXCLUDE := .pdf

build/coinor-csdp:: debian/stamp-build-coinor-csdp
debian/stamp-build-coinor-csdp:
	$(MAKE)
	touch $@

build/coinor-csdp-doc:: debian/stamp-build-coinor-csdp-doc
debian/stamp-build-coinor-csdp-doc:
	cd doc && ( pdflatex csdpuser.tex ; bibtex csdpuser; \
		pdflatex csdpuser.tex; pdflatex csdpuser.tex )
	touch $@

install/coinor-csdp:: debian/stamp-install-coinor-csdp
debian/stamp-install-coinor-csdp:
	mkdir -p debian/coinor-csdp/usr/bin
	make install DESTDIR=debian/coinor-csdp/usr/bin/
	@# rename executables with too generic names
	mv debian/coinor-csdp/usr/bin/theta debian/coinor-csdp/usr/bin/csdp-theta
	mv debian/coinor-csdp/usr/bin/rand_graph debian/coinor-csdp/usr/bin/csdp-randgraph
	mv debian/coinor-csdp/usr/bin/graphtoprob debian/coinor-csdp/usr/bin/csdp-graphtoprob
	mv debian/coinor-csdp/usr/bin/complement debian/coinor-csdp/usr/bin/csdp-complement
	touch $@

install/coinor-csdp-doc:: debian/stamp-install-coinor-csdp-doc
debian/stamp-install-coinor-csdp-doc:
	mkdir -p debian/coinor-csdp-doc/usr/share/doc/coinor-csdp-doc/
	cp doc/csdpuser.pdf \
		debian/coinor-csdp-doc/usr/share/doc/coinor-csdp-doc/
	touch $@

get-orig-source:
	-uscan --rename --upstream-version 0
	@echo successfully retrieved upstream tarball

clean::
	$(RM) debian/stamp-*
	$(MAKE) clean
	$(RM) doc/csdpuser.pdf doc/csdpuser.log doc/csdpuser.aux doc/csdpuser.bbl doc/csdpuser.blg
